Auto merge of #1107 - tomaka:extract-commands-system, r=alexcrichton
authorbors <bors@rust-lang.org>
Mon, 5 Jan 2015 16:36:00 +0000 (16:36 +0000)
committerbors <bors@rust-lang.org>
Mon, 5 Jan 2015 16:36:00 +0000 (16:36 +0000)
With this change, the various commands in Cargo now build a `CommandPrototype` instead of a `ProcessBuilder`. This `CommandPrototype` is then passed to an object that implements the `CommandsExecution` trait, which executes them.

Ideally `CommandPrototype` would look like this:

```rust
enum CommandPrototype {
    Rustc {
        libraries: Vec<String>,
        opt_level: uint,
        input: Path,
        ... etc... (all the options that can be passed to rustc)
    },
    Rustdoc {
        ...  (all the options that can be passed to rustdoc)
    },
    Custom {
        cmd: ...,
        env: ...,
    }
}
```

...but that's a bit too much work for now (maybe in a follow-up).

What this enables is using the Cargo library to intercept the build commands and tweak them. I'm planning to write `cargo-emscripten` thanks to this change.

With this, one could also imagine embedding rustc and rustdoc directly inside cargo, if that is needed.

1  2 
src/cargo/ops/cargo_rustc/compilation.rs
src/cargo/ops/cargo_rustc/custom_build.rs
src/cargo/ops/cargo_rustc/mod.rs

Simple merge